<template>
  <Card>
    <template>
      <div class="glory-board">
        <img src="@/assets/help-bg.png" alt="/" />
        <div class="glory-board-content" v-if="people.length">
          <div class="ul" v-for="(item, index) in people" :key="index">
            <div class="ul-index">{{ index + 1 }}</div>
            <div class="ul-list">
              <div class="name">{{ item.name }}({{ item.groupName }})</div>
              <div class="number">
                <span>认领数</span>
                <span style="color: #e6a23c; margin: 0 15px 0 5px">
                  {{ item.acceptNum }}</span
                >
                <span>完成数{{ item.finishNum }}</span>
              </div>
              <div class="scoring">
                <span> 评分 </span>
                <van-rate
                  :readonly="true"
                  v-model="item.score"
                  :size="20"
                  color="#ffd21e"
                  void-icon="star"
                  void-color="#eee"
                />
              </div>
            </div>
          </div>
        </div>
        <van-empty description="暂无数据" v-else />
      </div>
    </template>
  </Card>
</template>

<script>
import Card from "@/components/Card.vue";
import { postWxyHonourList } from "@/api/business.js";
export default {
  name: "HonorRoll",
  components: { Card },
  data() {
    return {
      people: [],
    };
  },
  created() {},
  mounted() {
    this.loadData();
  },
  methods: {
    loadData() {
      postWxyHonourList({ limit: 10, orderFlag: 1 }).then((res) => {
        const data = res.data || [];
        this.people = data.map((item) => {
          item.score = parseInt(item.score / 20);
          return item;
        });
      });
    },
  },
};
</script>

<style scoped lang="scss">
/* 光荣榜容器 */
.glory-board {
  img {
    width: 100%;
    height: 350px;
  }
  &-content {
    padding: 48px 30px;
    .ul {
      background-color: #fff;
      border-radius: 24px;
      padding: 29px 29px 29px 10px;
      display: flex;
      box-shadow: 0px 0px 0.667vw 0.533vw rgba(194, 194, 194, 0.2);
      margin-bottom: 20px;
      &-index {
        width: 150px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 30px;
        font-weight: bold;
        color: #f56c6c;
      }
      &-list {
        .name {
          font-size: 18px;
          font-weight: bold;
          margin-bottom: 15px;
        }
        .number {
          margin-bottom: 15px;
          color: #8d8c8c;
        }
        .scoring {
          color: #8d8c8c;
        }
      }
    }
  }
}
</style>
